Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@types/urijs
Advanced tools
TypeScript definitions for urijs
@types/urijs provides TypeScript type definitions for the URI.js library, which is used for URL manipulation and parsing.
Parsing URLs
This feature allows you to parse a URL into its components such as protocol, hostname, port, path, query, and fragment.
const URI = require('urijs');
const uri = new URI('https://example.com:8080/path?query=1#fragment');
console.log(uri.protocol()); // 'https'
console.log(uri.hostname()); // 'example.com'
console.log(uri.port()); // '8080'
console.log(uri.path()); // '/path'
console.log(uri.query()); // 'query=1'
console.log(uri.fragment()); // 'fragment'
Building URLs
This feature allows you to build a URL by setting its components such as protocol, hostname, port, path, query, and fragment.
const URI = require('urijs');
const uri = new URI();
uri.protocol('https')
.hostname('example.com')
.port(8080)
.path('/path')
.query('query=1')
.fragment('fragment');
console.log(uri.toString()); // 'https://example.com:8080/path?query=1#fragment'
Manipulating Query Parameters
This feature allows you to manipulate query parameters in a URL by adding or removing them.
const URI = require('urijs');
const uri = new URI('https://example.com/path?query=1');
uri.addQuery('newParam', 'newValue');
console.log(uri.toString()); // 'https://example.com/path?query=1&newParam=newValue'
uri.removeQuery('query');
console.log(uri.toString()); // 'https://example.com/path?newParam=newValue'
The query-string package is used for parsing and stringifying URL query strings. It is simpler and more focused on query string manipulation compared to URI.js, which offers a broader range of URL manipulation features.
The url-parse package provides similar functionality to URI.js for parsing and manipulating URLs. It is lightweight and focuses on URL parsing and construction, but may not offer as many features as URI.js.
The whatwg-url package is a full implementation of the WHATWG URL Standard. It provides comprehensive URL parsing and manipulation capabilities, similar to URI.js, but follows the WHATWG specifications closely.
npm install --save @types/urijs
This package contains type definitions for urijs (http://medialize.github.io/URI.js).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/urijs.
These definitions were written by RodneyJT, Brian Surowiec, Pete Johanson, Zhibin Liu, TeamworkGuy2, Akuukis, Marcell Toth, Vincenzo Chianese, Andree Hagelstein, and Alexander Pepper.
FAQs
TypeScript definitions for urijs
The npm package @types/urijs receives a total of 850,185 weekly downloads. As such, @types/urijs popularity was classified as popular.
We found that @types/urijs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.